package com.oocl.network;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

import com.oocl.commandProcess.CommandProcess;
import com.oocl.printFormat.PrintFormat;
import com.sun.corba.se.spi.orbutil.fsm.Input;

public class NetworkOperat{
	
	CommandProcess cp;
	PrintFormat pf;
	
	public NetworkOperat(){
		cp = new CommandProcess();
		pf = new PrintFormat();
	}
	
	public void start() throws IOException{
		ServerSocket server = new ServerSocket(8888);
		Socket socket = server.accept();
		InputStream in = socket.getInputStream();
		OutputStream out = socket.getOutputStream();
		out.write("Welcome! \r\n".getBytes() );
		while(true){
			cp.process(in,out);
		}
	}
}
